package com.am.link;

import com.am.AMObject;
import com.am.cell.Cell;
import com.am.cell.ICell;

public abstract class AMLink extends AMObject {
	private ICell src;
	private ICell des;

	public AMLink(int defaultResistance, ICell src, ICell des) {
		super(defaultResistance);
		this.src = src;
		this.des = des;
	}

	public ICell getSource() {
		return src;
	}

	@Override
	public boolean equals(Object o) {
		// Not strictly necessary, but often a good optimization
		if (this == o)
			return true;
		if (!(o instanceof AMLink))
			return false;
		AMLink co = (AMLink) o;
		return src.equals(co.getSource()) && des.equals(co.getDestination());
	}

	@Override
	public int hashCode() {
		int hash = 1;
		hash = hash * 31 + src.hashCode();
		hash = hash * 31 + des.hashCode();
		return hash;
	}

	public ICell getDestination() {
		return des;
	}

}
